Title: Archive
---
@{
    Layout = "/_Layout.cshtml";
}
 
 <div class="content">
@{
    foreach(IGrouping<int, IDocument> year in Model.DocumentList(Keys.PageDocuments)
        .Where(x => x.ContainsKey(BlogKeys.Published))
        .OrderByDescending(x => x.Get<DateTime>(BlogKeys.Published))
        .GroupBy(x => x.Get<DateTime>(BlogKeys.Published).Year)
        .OrderByDescending(x => x.Key))
    {
        <header class="major">
            <h2>@year.Key</h2>
        </header>
        @Html.Partial("_PostList", year);
    }
    
    <ul class="actions">            
        @if(Model.Bool(Keys.HasPreviousPage))
        {
            <li>    
                <a href="@(Context.GetLink(Model.Document(Keys.PreviousPage)))" class="button"><span aria-hidden="true">&larr;</span> Newer</a>
                         
            </li>
        } 
        @if(Model.Bool(Keys.HasNextPage))
        {
            <li>
                <a href="@(Context.GetLink(Model.Document(Keys.NextPage)))" class="button">Older <span aria-hidden="true">&rarr;</span></a>
            </li>
        }
    </ul>
}
</div>